﻿using RimWorld;
using Verse;
using System.Collections.Generic;
using UnityEngine;
using Verse.AI;

namespace RimZombieGirl
{
    public class Building_CursedGrave : Building
    {
        public CompCursedGrave CompCursedGrave => GetComp<CompCursedGrave>();

        public override IEnumerable<FloatMenuOption> GetFloatMenuOptions(Pawn pawn)
        {
            foreach (FloatMenuOption option in base.GetFloatMenuOptions(pawn))
                yield return option;

            if (pawn.CanReserveAndReach(this, PathEndMode.Touch, Danger.Deadly))
            {
                yield return new FloatMenuOption("Dig up cursed grave".Translate(), () =>
                {
                    Job job = JobMaker.MakeJob(ZGJobDefOf.Job_DigCursedGrave, this);
                    pawn.jobs.TryTakeOrderedJob(job);
                });
            }
        }

        public override void DeSpawn(DestroyMode mode = DestroyMode.Vanish)
        {
            Map map = this.Map;
            if (map != null)
            {
                PollutionUtility.GrowPollutionAt(this.Position, map, 12);
            }
            base.DeSpawn(mode);


        }
    }
}
